/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package spaceconquest3d;

import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;
import com.jme3.light.AmbientLight;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Spatial;

/**
 *
 * @author Michael
 */
public class Battle implements GameStateClass {
    private BulletAppState bulletAppState;
    private SimpleApplication app;
    private AmbientLight ambientLight;
    
    public Battle(SimpleApplication app) {
        this.app = app;
        bulletAppState = new BulletAppState();
        
        ambientLight = new AmbientLight();
        ambientLight.setColor(ColorRGBA.White.mult(0.2f));
    }

    public void update(float tpf) {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public void load() {
        app.getStateManager().attach(bulletAppState);
        
        Spatial scene = app.getAssetManager().loadModel("Scenes/TheOrbit.j3o");
        app.getRootNode().attachChild(scene);
        
        app.getRootNode().addLight(ambientLight);
        
        // TODO create a player
    }

    public void unload() {
        app.getRootNode().detachAllChildren();
        app.getRootNode().removeLight(ambientLight);
        app.getStateManager().detach(bulletAppState);
    }
}
